package com.example.usercode.service.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Copyright (C), 2022-2022, 姚兵
 * Author: 32210
 * Date: 2022/10/10 13:54
 * FileName: R
 * Description:
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class R {
    private int code;
    private String msg;
    private Object data;

    public R(int code){
        this.code=code;
    }
    public static R ok(){
        return new R(200);
    }


    public static R err(){
        return new R(500).msg("错误");
    }

    public R code(int code){
        this.code=code;
        return this;
    }
    public R msg(String msg){
        this.msg=msg;
        return this;
    }

    public R data(Object data){
        this.data=data;
        return this;
    }
}
